// 统一管理首页模块接口
import request from "../../utils/request";
import type { HospitalResponseData, HospitalLevelAndAreaResponseData ,HospitalInfo} from "./type"
//通过枚举管理首页模块的接口地址
enum API {
    //获取已有的医院数据接口地址
    HOSPITAL_URL = '/hosp/hospital/',
    // 获取医院的等级和地区接口地址
    HOSPITAL_LEVEL_AREA_URL = '/cmn/dict/findByDictCode/',
    // 根据医院名称获取医院列表
    HOSPITAL_SEARCH_URL = '/hosp/hospital/findByHosname/'
}
// `${page}/${limit}` 字符串插值
// 获取医院数据
export const reqHospital = (page: number, limit: number,hostype='',districtCode='') => 
request.get<any, HospitalResponseData>(API.HOSPITAL_URL + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`)
// 获取医院等级或地区数据
export const reqHospitalLevelAndArea = (dictCode: string) => 
request.get<any, HospitalLevelAndAreaResponseData>(API.HOSPITAL_LEVEL_AREA_URL + `${dictCode}`)
// 获取关键字搜索医院数据
export const reqHospitalInfo = (hosname:string)=>
request.get<any,HospitalInfo>(API.HOSPITAL_SEARCH_URL + hosname)